//
//  TourismDetailsEntity.m
//  SXH
//
//  Created by 房 国生 on 15/7/23.
//  Copyright (c) 2015年 lyss. All rights reserved.
//

#import "TourismDetailsEntity.h"
#import "RouteDetailModel.h"
/*
 @property (nonatomic, strong) NSString *t_id;
 @property (nonatomic, strong) NSString *t_name;
 @property (nonatomic, strong) NSString *t_preview;
 @property (nonatomic, strong) NSString *t_day;
 @property (nonatomic, strong) NSString *t_departure_date;
 @property (nonatomic, strong) NSString *t_vehicle;
 @property (nonatomic, strong) NSString *album_thumb;
 @property (nonatomic, strong) NSString *t_image_url;
 @property (nonatomic, strong) NSString *t_insert_time;
 @property (nonatomic, strong) NSString *t_update_time;
 @property (nonatomic, strong) NSString *t_old_price;
 @property (nonatomic, strong) NSString *t_price;
 @property (nonatomic, strong) NSString *t_cityname;
 @property (nonatomic, strong) NSString *c_id;
 @property (nonatomic, strong) NSString *a_id;
 @property (nonatomic, strong) NSString *t_is_recommend;
 @property (nonatomic, strong) NSString *in_id;
 @property (nonatomic, strong) NSString *in_reference;
 @property (nonatomic, strong) NSString *in_tariff_description;
 @property (nonatomic, strong) NSString *a_name;
 @property (nonatomic, strong) NSString *a_log;
 @property (nonatomic, strong) NSString *a_tel;
 @property (nonatomic, strong) NSString *a_fax;
 @property (nonatomic, strong) NSString *a_address;
 @property (nonatomic, strong) NSString *a_cityname;
 @property (nonatomic, strong) NSString *a_user;
 @property (nonatomic, strong) NSString *a_email;
 */
@implementation TourismDetailsEntity

- (instancetype)initWithAttributes:(NSDictionary *)attributes {
    
    self = [super init];
    if (!self) {
        return nil;
    }
    
    self.t_id= [attributes valueForKeyPath:@"t_id"];
    self.t_name= [attributes valueForKeyPath:@"t_name"];
    self.a_id= [attributes valueForKeyPath:@"a_id"];
    self.a_name = [attributes valueForKeyPath:@"a_name"];
    self.a_tel = [attributes valueForKeyPath:@"a_tel"];
    self.a_fax = [attributes valueForKeyPath:@"a_fax"];
    self.a_log = [NSString stringWithFormat:@"%@/%@", IMAGE_URL, [attributes valueForKeyPath:@"a_log"]];
    self.a_address = [attributes valueForKeyPath:@"a_address"];
    self.a_cityname = [attributes valueForKeyPath:@"a_cityname"];
    self.a_user = [attributes valueForKeyPath:@"a_user"];
    self.c_id = [attributes valueForKeyPath:@"c_id"];
    
    self.album_thumb = [NSString stringWithFormat:@"%@/%@", IMAGE_URL, [attributes valueForKeyPath:@"album_thumb"]];
    self.t_image_url = [NSString stringWithFormat:@"%@/%@", IMAGE_URL, [attributes valueForKeyPath:@"t_image_url"]];
    self.t_insert_time = [attributes valueForKeyPath:@"t_insert_time"];
    self.t_update_time = [attributes valueForKeyPath:@"t_update_time"];
    self.t_old_price = [attributes valueForKeyPath:@"t_oldprice"];
    self.t_price = [attributes valueForKeyPath:@"t_price"];
    self.t_cityname = [attributes valueForKeyPath:@"t_cityname"];
    self.t_is_recommend = [attributes valueForKeyPath:@"t_is_recommend"];
    self.in_id = [attributes valueForKeyPath:@"in_id"];
    self.in_reference = [attributes valueForKeyPath:@"in_reference"];
    self.in_tariff_description = [NSString stringWithFormat:@"%@/%@", IMAGE_URL, [attributes valueForKeyPath:@"in_tariff_description"]];
    self.a_email = [attributes valueForKeyPath:@"a_email"];
    self.t_preview = ([attributes valueForKeyPath:@"t_preview"]==[NSNull null])?@"NULL":[attributes valueForKeyPath:@"t_preview"];
    self.t_day = [attributes valueForKeyPath:@"t_day"];
    NSError * error = nil;
    self.t_departure_date_list = [RouteDetailModel arrayOfModelsFromDictionaries:[attributes valueForKeyPath:@"t_departure_date_list"] error:&error];
    self.t_vehicle = [attributes valueForKeyPath:@"t_vehicle"];
    self.t_preview = [attributes valueForKeyPath:@"t_preview"];
    self.t_preview = [attributes valueForKeyPath:@"t_preview"];
    self.in_characteristic = [NSString stringWithFormat:@"%@/%@", IMAGE_URL, [attributes valueForKeyPath:@"in_characteristic"]];
    self.in_reservation_information = [NSString stringWithFormat:@"%@/%@", IMAGE_URL, [attributes valueForKeyPath:@"in_reservation_information"]];
    self.adult_price = [[attributes valueForKeyPath:@"adult_price"]floatValue];
    self.oldman_price = [[attributes valueForKeyPath:@"oldman_price"]floatValue];
    self.children_price = [[attributes valueForKeyPath:@"children_price"]floatValue];
    self.children_occupy_price = [[attributes valueForKeyPath:@"children_occupy_price"]floatValue];
    self.can_sale = [attributes valueForKeyPath:@"can_sale"];
    
    return self;
}

@end
